/// 辅助 * 缓存

import { useCache } from '@expresso/plus'
import { getConfig } from './config'
import type { LoginInfo } from '@/apis/Login'
import type { BroadcastData } from '@/hooks'

//# 类型

type Cache = {
  token: {
    accessToken: string
    refreshToken: string
  } | Nil
  loginInfo: LoginInfo | Nil
  diagramInfo: any
  droadcastData: BroadcastData | Nil
}

export type { Cache }

//# 定义

const cache = useCache(
  getConfig(),

  /* Local Keys */
  ['token', 'loginInfo', 'droadcastData'],

  /* Session Keys */
  ['diagramInfo'],
)

//# 导出

export { cache }
